﻿using System;
using System.Data.Linq;
using System.Data.Linq.Mapping;

namespace DataEntities
{
    [Table(Name = "dbo.ChuZuInfo")]
    public class ChuZuInfo : Entity
    {

        private int _iCZDId;

        private int _iKeHuId;

        private int _iCarid;

        private double _dRiFuJE;

        private double _dYouHuiJE;

        private double _dYuFuJE;

        private double _dYaJing;

        private double _dShiFuJE;

        private DateTime _tStartDate;

        private DateTime _tEndDate;

        private bool _bXZ;

        private bool _bCZZF;

        private EntitySet<TuiHuanInfo> _TuiHuanInfo;

        private EntitySet<WeiZhangInfo> _WeiZhangInfo;

        private EntitySet<XuZuInfo> _XuZuInfo;

        private EntityRef<CarInfo> _CarInfo;

        private EntityRef<KeHuInfo> _KeHuInfo;

        public ChuZuInfo()
        {
            _TuiHuanInfo = new EntitySet<TuiHuanInfo>(attach_TuiHuanInfo, detach_TuiHuanInfo);
            _WeiZhangInfo = new EntitySet<WeiZhangInfo>(attach_WeiZhangInfo, detach_WeiZhangInfo);
            _XuZuInfo = new EntitySet<XuZuInfo>(attach_XuZuInfo, detach_XuZuInfo);
            _CarInfo = default(EntityRef<CarInfo>);
            _KeHuInfo = default(EntityRef<KeHuInfo>);
        }

        [Column(Storage = "_iCZDId", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
        public int iCZDId
        {
            get
            {
                return _iCZDId;
            }
            set
            {
                if ((_iCZDId != value))
                {
                    SendPropertyChanging("iCZDId");
                    _iCZDId = value;
                    SendPropertyChanged("iCZDId",value);
                }
            }
        }

        [Column(Storage = "_iKeHuId", DbType = "Int")]
        public int iKeHuId
        {
            get
            {
                return _iKeHuId;
            }
            set
            {
                if ((_iKeHuId != value))
                {
                    if (_KeHuInfo.HasLoadedOrAssignedValue)
                    {
                        throw new ForeignKeyReferenceAlreadyHasValueException();
                    }
                    SendPropertyChanging("iKeHuId");
                    _iKeHuId = value;
                    SendPropertyChanged("iKeHuId",value);
                }
            }
        }

        [Column(Storage = "_iCarid", DbType = "Int")]
        public int iCarid
        {
            get
            {
                return _iCarid;
            }
            set
            {
                if ((_iCarid != value))
                {
                    if (_CarInfo.HasLoadedOrAssignedValue)
                    {
                        throw new ForeignKeyReferenceAlreadyHasValueException();
                    }
                    SendPropertyChanging("iCarid");
                    _iCarid = value;
                    SendPropertyChanged("iCarid",value);
                }
            }
        }

        [Column(Storage = "_dRiFuJE", DbType = "Float")]
        public double dRiFuJE
        {
            get
            {
                return _dRiFuJE;
            }
            set
            {
                if ((_dRiFuJE != value))
                {
                    SendPropertyChanging("dRiFuJE");
                    _dRiFuJE = value;
                    SendPropertyChanged("dRiFuJE",value);
                }
            }
        }

        [Column(Storage = "_dYouHuiJE", DbType = "Float")]
        public double dYouHuiJE
        {
            get
            {
                return _dYouHuiJE;
            }
            set
            {
                if ((_dYouHuiJE != value))
                {
                    SendPropertyChanging("dYouHuiJE");
                    _dYouHuiJE = value;
                    SendPropertyChanged("dYouHuiJE",value);
                }
            }
        }

        [Column(Storage = "_dYuFuJE", DbType = "Float")]
        public double dYuFuJE
        {
            get
            {
                return _dYuFuJE;
            }
            set
            {
                if ((_dYuFuJE != value))
                {
                    SendPropertyChanging("dYuFuJE");
                    _dYuFuJE = value;
                    SendPropertyChanged("dYuFuJE",value);
                }
            }
        }

        [Column(Storage = "_dYaJing", DbType = "Float")]
        public double dYaJing
        {
            get
            {
                return _dYaJing;
            }
            set
            {
                if ((_dYaJing != value))
                {
                    SendPropertyChanging("dYaJing");
                    _dYaJing = value;
                    SendPropertyChanged("dYaJing",value);
                }
            }
        }

        [Column(Storage = "_dShiFuJE", DbType = "Float")]
        public double dShiFuJE
        {
            get
            {
                return _dShiFuJE;
            }
            set
            {
                if ((_dShiFuJE != value))
                {
                    SendPropertyChanging("dShiFuJE");
                    _dShiFuJE = value;
                    SendPropertyChanged("dShiFuJE",value);
                }
            }
        }

        [Column(Storage = "_tStartDate", DbType = "DateTime")]
        public DateTime tStartDate
        {
            get
            {
                return _tStartDate;
            }
            set
            {
                if ((_tStartDate != value))
                {
                    SendPropertyChanging("tStartDate");
                    _tStartDate = value;
                    SendPropertyChanged("tStartDate",value);
                }
            }
        }

        [Column(Storage = "_tEndDate", DbType = "DateTime")]
        public DateTime tEndDate
        {
            get
            {
                return _tEndDate;
            }
            set
            {
                if ((_tEndDate != value))
                {
                    SendPropertyChanging("tEndDate");
                    _tEndDate = value;
                    SendPropertyChanged("tEndDate",value);
                }
            }
        }

        [Column(Storage = "_bXZ", DbType = "Bit")]
        public bool bXZ
        {
            get
            {
                return _bXZ;
            }
            set
            {
                if ((_bXZ != value))
                {
                    SendPropertyChanging("bXZ");
                    _bXZ = value;
                    SendPropertyChanged("bXZ",value);
                }
            }
        }

        [Column(Storage = "_bCZZF", DbType = "Bit")]
        public bool bCZZF
        {
            get
            {
                return _bCZZF;
            }
            set
            {
                if ((_bCZZF != value))
                {
                    SendPropertyChanging("bCZZF");
                    _bCZZF = value;
                    SendPropertyChanged("bCZZF",value);
                }
            }
        }

        [Association(Name = "ChuZuInfo_TuiHuanInfo", Storage = "_TuiHuanInfo", ThisKey = "iCZDId", OtherKey = "iCZDId")]
        public EntitySet<TuiHuanInfo> TuiHuanInfo
        {
            get
            {
                return _TuiHuanInfo;
            }
            set
            {
                _TuiHuanInfo.Assign(value);
            }
        }

        [Association(Name = "ChuZuInfo_WeiZhangInfo", Storage = "_WeiZhangInfo", ThisKey = "iCZDId", OtherKey = "iCZDId")]
        public EntitySet<WeiZhangInfo> WeiZhangInfo
        {
            get
            {
                return _WeiZhangInfo;
            }
            set
            {
                _WeiZhangInfo.Assign(value);
            }
        }

        [Association(Name = "ChuZuInfo_XuZuInfo", Storage = "_XuZuInfo", ThisKey = "iCZDId", OtherKey = "iCZDId")]
        public EntitySet<XuZuInfo> XuZuInfo
        {
            get
            {
                return _XuZuInfo;
            }
            set
            {
                _XuZuInfo.Assign(value);
            }
        }

        [Association(Name = "CarInfo_ChuZuInfo", Storage = "_CarInfo", ThisKey = "iCarid", OtherKey = "iCarid", IsForeignKey = true)]
        public CarInfo CarInfo
        {
            get
            {
                return _CarInfo.Entity;
            }
            set
            {
                CarInfo previousValue = _CarInfo.Entity;
                if (((previousValue != value)
                            || (_CarInfo.HasLoadedOrAssignedValue == false)))
                {
                    SendPropertyChanging("CarInfo");
                    if ((previousValue != null))
                    {
                        _CarInfo.Entity = null;
                        previousValue.ChuZuInfo.Remove(this);
                    }
                    _CarInfo.Entity = value;
                    if ((value != null))
                    {
                        value.ChuZuInfo.Add(this);
                        _iCarid = value.iCarid;
                    }
                    else
                    {
                        _iCarid = default(int);
                    }
                    SendPropertyChanged("CarInfo",value);
                }
            }
        }

        [Association(Name = "KeHuInfo_ChuZuInfo", Storage = "_KeHuInfo", ThisKey = "iKeHuId", OtherKey = "iKeHuId", IsForeignKey = true)]
        public KeHuInfo KeHuInfo
        {
            get
            {
                return _KeHuInfo.Entity;
            }
            set
            {
                KeHuInfo previousValue = _KeHuInfo.Entity;
                if (((previousValue != value)
                            || (_KeHuInfo.HasLoadedOrAssignedValue == false)))
                {
                    SendPropertyChanging("KeHuInfo");
                    if ((previousValue != null))
                    {
                        _KeHuInfo.Entity = null;
                        previousValue.ChuZuInfo.Remove(this);
                    }
                    _KeHuInfo.Entity = value;
                    if ((value != null))
                    {
                        value.ChuZuInfo.Add(this);
                        _iKeHuId = value.iKeHuId;
                    }
                    else
                    {
                        _iKeHuId = default(int);
                    }
                    SendPropertyChanged("KeHuInfo",value);
                }
            }
        }

        private void attach_TuiHuanInfo(TuiHuanInfo entity)
        {
            entity.ChuZuInfo = this;
        }

        private void detach_TuiHuanInfo(TuiHuanInfo entity)
        {
            entity.ChuZuInfo = null;
        }

        private void attach_WeiZhangInfo(WeiZhangInfo entity)
        {
            entity.ChuZuInfo = this;
        }

        private void detach_WeiZhangInfo(WeiZhangInfo entity)
        {
            entity.ChuZuInfo = null;
        }

        private void attach_XuZuInfo(XuZuInfo entity)
        {
            entity.ChuZuInfo = this;
        }

        private void detach_XuZuInfo(XuZuInfo entity)
        {
            entity.ChuZuInfo = null;
        }
    }
}
